#pragma once
#include "Request.hpp"
#include <iostream>
#include <vector>
#include <regex>

#include <memory>

using namespace protocol_ns;

class MatcherBase
{
public:
    virtual ~MatcherBase() = default;

    virtual bool Match(Request &req) const = 0;
};

class PathParamsMatcher : public MatcherBase
{
public:
    PathParamsMatcher(const std::string &pattern);

    bool Match(Request &req) const override
    {
        // match规则
    }

private:
    static constexpr char marker = ':';
    static constexpr char separator = '/';
    std::vector<std::string> static_fragments_;
    std::vector<std::string> param_names_;
};

class RegexMatcher : public MatcherBase
{
public:
    RegexMatcher(const std::string &pattern) : regex_(pattern) {}

    bool Match(Request &req) const override
    {
        
    }

private:
    std::regex regex_;
};

std::unique_ptr<MatcherBase>
make_matcher(const std::string pattern)
{
    if (pattern.find("/:") != std::string::npos)
    {
        return std::make_unique<PathParamsMatcher>(pattern);
    }
    else
    {
        return std::make_unique<RegexMatcher>(pattern);
    }
}